package space.edge.d.demo.qrcode;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.Button;

/**
 * Created by gsl on 2017/11/10.
 */

public class MActivity extends Activity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_m);

        Button btnGenCode = (Button) findViewById(R.id.btn_generate_code);
        Button btnScanner = (Button) findViewById(R.id.btn_scanner);

        btnGenCode.setOnClickListener(clickListener);
        btnScanner.setOnClickListener(clickListener);
    }

    private View.OnClickListener clickListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            switch (v.getId()) {
                case R.id.btn_generate_code:
                    MActivity.this.startActivity(CodeGeneratorActivity.newIntent(MActivity.this));
                    break;
                case R.id.btn_scanner:
                    MActivity.this.startActivity(PreviewActivity.newIntent(MActivity.this));
                    break;
            }
        }
    };
}
